package com.fishingwithme.android.ui.screens.map.handlers

import com.fishingwithme.android.R

/**
 * 切换地图类型处理器 - 通用处理器（空实现）
 */
class SwitchMapTypeEventHandler : BaseHandler() {
    override val key: String = "switchMapType"
    override val icon: Int = R.mipmap.satellite  // 使用"map"图标表示切换地图类型

    override fun active() {
        switch()
    }

    fun switch() {
        try {
            this.map?.let { tencentMap ->
                val currentType = tencentMap.mapType
                val newType = when (currentType) {
                    com.tencent.tencentmap.mapsdk.maps.TencentMap.MAP_TYPE_NORMAL -> com.tencent.tencentmap.mapsdk.maps.TencentMap.MAP_TYPE_SATELLITE
                    com.tencent.tencentmap.mapsdk.maps.TencentMap.MAP_TYPE_SATELLITE -> com.tencent.tencentmap.mapsdk.maps.TencentMap.MAP_TYPE_NORMAL
                    else -> com.tencent.tencentmap.mapsdk.maps.TencentMap.MAP_TYPE_NORMAL
                }
                tencentMap.mapType = newType
            }
        } catch (e: Exception) {
            android.util.Log.w("SwitchMapType", "Error switching map type", e)
        }
    }
}